High availability application messaging layer

ABSTRACT

Certain embodiments enable application message delivery to be automatically guaranteed for all failover scenarios through use of a novel infrastructure layer that supports high availability (HA) messaging. The High Availability Application Messaging Layer (HAML) can guarantee delivery of application messages whether a failover occurs at one or both of the source and the intended destination of the message. The HAML may transmit messages to one intended destination, as unicast messaging, or to multiple intended destinations, as multicast messaging. In some embodiments, the HAML may be HA aware, which refers to the awareness of the HAML of the redundancy for all processing entities within a network device to ensure hitless failover at the network device. By moving support for HA messaging from individual applications to the HAML, as a common infrastructure layer across the processing entities, the individual applications do not need to implement additional software to explicitly support HA messaging.

CROSS-REFERENCES TO RELATED APPLICATIONS

The present application is a non-provisional of and claims the benefit and priority under 35 U.S.C. 119(e) of U.S. Provisional Application No. 61/704,281 filed Sep. 21, 2012, entitled HA APPLICATION MESSAGING LAYER, the entire contents of which are incorporated herein by reference for all purposes.

The present application is related to U.S. patent application Ser. No. 13/827,641, filed on Mar. 14, 2013, and entitled ROLE BASED MULTICAST MESSAGING INFRASTRUCTURE, naming Chin et al. (hereinafter “Chin”), the entirety of which is herein incorporated by reference for all purposes.

BACKGROUND

The present disclosure relates to networking and more particularly to techniques for communicating messages between processing entities on a network device.

A network device may have multiple processing entities within the device. In a distributed software model, each processing entity may execute one or more applications running on an operating system and network system. The network system may comprise a network stack, such as an OSI network stack of networking layer protocols. Different instantiations of an application may run on multiple processing entities within the network device, and application messages may be communicated between the instantiations using messaging schemes supported by the networking layer protocols.

The multiple processing entities may provide redundancy to the network device to avoid traffic disruption upon a failure event, wherein a failover should occur to switch processing to a redundant or standby processing entity. In some network devices, there is a need for high failover capability in order to provide high availability (HA) or continuous availability messaging to ensure hitless failover. Typically, applications that support HA messaging need to ensure redundancy for all permutations of failures at the processing entities of the network device. To avoid losing critical messages during a failover, an application needs to guarantee that messages can be delivered regardless of which end (i.e., the source or the destination) is failing over. This typically requires an application to include additional software to handle the various failover permutations. Thus, multiple applications running on a network device may each need to implement its own software to support HA messaging.

BRIEF SUMMARY

Certain embodiments of the present invention enable application message delivery to be automatically guaranteed for all failover scenarios through use of a novel infrastructure layer that supports HA messaging. The High Availability Application Messaging Layer (HAML) can guarantee delivery of application messages whether a failover occurs at one or both of the source and the intended destination of the message. The HAML may be used to transmit messages to one or more intended destinations. Accordingly, the HAML may be used for unicast messaging or for multicast messaging. In some embodiments, the HAML may be HA aware, which refers to the awareness of the HAML of the redundancy for all processing entities within a network device to ensure hitless failover at the network device. By moving support for HA messaging from individual applications to the HAML, as a common infrastructure layer across the processing entities, the individual applications do not need to implement additional software to explicitly support HA messaging.

In one embodiment, a network device comprises a first processing entity, a second processing entity, a third processing entity, and a fourth processing entity. The first processing entity is configurable to operate in a first role and to transmit a message for an intended destination, where the first processing entity is the source of the message. The second processing entity is configurable to operate in a second role, to receive the message, and to store the message at the second processing entity, where the second processing entity is a peer to the source of the message. The third processing entity is configurable to operate in the first role and to receive the message, where the third processing entity is the intended destination of the message. The fourth processing entity is configurable to operate in the second role, to receive the message, and to store the message at the fourth processing entity, where the fourth processing entity is a peer to the intended destination of the message.

In certain embodiments, the first role is an active role, wherein a processing entity operating in the first role is further configurable to perform a set of transport-related functions in the active role; and the second role is a standby role, wherein a processing entity operating in the second role is further configurable to not perform the set of transport-related functions in the standby role. In certain embodiments, the first processing entity is further configurable to receive an acknowledgement indicating that the message was received at the third processing entity and at the fourth processing entity, and in response to receiving the acknowledgement, to transmit a notification to the second processing entity to remove the message stored at the second processing entity; and the second processing entity is further configurable to receive the notification, and in response to receiving the notification, to remove the message stored at the second processing entity. The fourth processing entity may be further configurable to switch to operation in the first role from the second role when the third processing entity is no longer operating in the first role, to read the message, and to process the message.

In certain embodiments, the third processing entity is further configurable to read the message, to process the message, and after processing the message, to transmit a notification to the fourth processing entity to remove the message stored at the fourth processing entity; and the fourth processing entity is further configurable to receive the notification, and in response to receiving the notification, to remove the message stored at the fourth processing entity. In certain embodiments, the first processing entity is further configurable to block control, to receive an acknowledgement indicating that the message was received at the second processing entity, and in response to receiving the acknowledgement, to unblock control. The second processing entity may be further configurable to switch to operation in the first role from the second role when the first processing entity is no longer operating in the first role, and to transmit the message for the intended destination.

In certain embodiments, the first processing entity is further configured to receive an error notification indicating that the message was not received at the third processing entity. In certain embodiments, the message is for multiple intended destinations; and the first processing entity is further configurable to transmit the message to each intended destination of the multiple intended destinations, and to transmit the message to each peer to each intended destination of the multiple intended destinations.

In one embodiment, a method comprises transmitting a message for an intended destination from a first processing entity operating in a first role, where the first processing entity is the source of the message; receiving the message at a second processing entity operating in a second role, where the message is stored at the second processing entity, and the second processing entity is a peer to the source of the message; receiving the message at a third processing operating in the first role, where the third processing entity is the intended destination of the message; and receiving the message at a fourth processing entity operating in the second role, where the message is stored at the fourth processing entity, and the fourth processing entity is a peer to the intended destination of the message.

In one embodiment, a network device comprises a first processing entity and a second processing entity. The first processing entity is configurable to operate in a first role and to transmit a message for an intended destination. The second processing entity is configurable to operate in a second role and to receive the message. Upon occurrence of a failure event at the first processing entity, the second processing entity is configurable to switch to operating in the first role to determine that the second processing entity is a source of the message based on the second processing entity operating in the first role, and to transmit the message to the intended destination.

In one embodiment, a network device comprises a first processing entity and a second processing entity. The first processing entity is configurable to operate in a first role, where the first processing entity is an intended destination of a message. The second processing entity is configurable to operate in a second role and to receive the message. Upon occurrence of a failure event at the first processing entity, the second processing entity is configurable to switch to operating in the first role to determine that the second processing entity is the intended destination based on the second processing entity operating in the first role, and to process the message as the intended destination.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a simplified block diagram of a network device that may incorporate an embodiment of the present invention;

FIG. 2 depicts a simplified flowchart depicting transporting of a message between processing entities according to an embodiment of the present invention;

FIG. 3 is yet another simplified block diagram of a network device that may incorporate embodiments of the present invention;

FIG. 4 depicts a simplified flowchart depicting transporting of a message between processing entities when a failure event occurs at the source of the message according to an embodiment of the present invention;

FIG. 5 is yet another simplified block diagram of a network device that may incorporate embodiments of the present invention;

FIG. 6 depicts a simplified flowchart depicting transporting of a message between processing entities when a failure event occurs at the intended destination of the message according to an embodiment of the present invention;

FIG. 7 is yet another simplified block diagram of a network device that may incorporate embodiments of the present invention;

FIG. 8 is a simplified block diagram of a processing entity of a card in a network device that may incorporate embodiments of the present invention;

FIG. 9 depicts an exemplary OSI network stack for the networking protocols used in one embodiment of the present invention; and

The foregoing, together with other features and embodiments will become more apparent upon referring to the following specification, claims, and accompanying drawings.

DETAILED DESCRIPTION

Attached as the Appendix are example application programming interfaces (APIs) for a High Availability Application Messaging Layer (HAML) that may be implemented in accordance with embodiments of the present invention.

It should be understood that the specific embodiments described in the Appendix are not limiting examples of the invention and that some aspects of the invention might use the teachings of the Appendix while others might not. It should also be understood that limiting statements in the Appendix may be limiting as to requirements of specific embodiments and such limiting statements might or might not pertain to the claimed inventions and, therefore, the claim language need not be limited by such limiting statements.

In the following description, for the purposes of explanation, specific details are set forth in order to provide a thorough understanding of certain embodiments of the invention. However, it will be apparent that various embodiments may be practiced without these specific details. The figures and description are not intended to be restrictive.

Certain embodiments of the present invention enable application message delivery to be automatically guaranteed for all failover scenarios through use of a novel infrastructure layer that supports HA messaging. The HAML can guarantee delivery of application messages whether a failover occurs at one or both of the source and the intended destination of the message. The HAML may be used to transmit messages to one or more intended destinations. Accordingly, the HAML may be used for unicast messaging or for multicast messaging. The HAML is fully reentrant and HA aware, which refers to the awareness of the HAML of the redundancy for all processing entities within a network device to ensure hitless failover at the network device. By moving support for HA messaging from individual applications to the HAML, as a common infrastructure layer across the processing entities, the individual applications no longer need to implement additional software to explicitly support HA messaging.

The HAML guarantees delivery of an application message in a source failover scenario by automatically transmitting the message to, and storing the message at, a peer for the source of the message. The HAML transmits the message to the source peer automatically without the application needing to explicitly transmit the message to the source peer directly. If a failure event then occurs at the source, the source peer can transmit the message to the destination, ensuring delivery. Further explanations are provided below for a source, a destination, and a peer.

Similarly, the HAML guarantees delivery of an application message in a destination failover scenario by automatically transmitting the message to, and storing the message at, a peer for each of one or more intended destinations (e.g., the one or more destinations designated or specified in the message). The HAML automatically multicasts (i.e., transmits at the same time) the message to each intended destination and each destination peer without the application needing to explicitly transmit the message to the destination peers directly. If a failure event then occurs at an intended destination, the respective destination peer can process the message in lieu of processing by the affected intended destination.

In certain embodiments, the HAML may be implemented as a library interface, which may be linked to by user space applications running on a network device. In certain embodiments, messages are delivered to each destination in the same order that the messages were sent. In some embodiments, application messages sent using the HAML may be idempotent (i.e., the messages produce the same result if processed one or more times), as duplicate messages may be received by an application in the event of a failover. However, it is expected that the application would discard the duplicate messages. In other embodiments, the HAML may ensure duplicate messages are not delivered to the application. In some embodiments, errors may be reported asynchronously, for example, if message synchronization between peers is lost, or a destination is no longer able to accept messages.

FIG. 1 is a simplified block diagram of a network device 100 that may incorporate an embodiment of the present invention. Network device 100 includes, with reference to an application message, a source 110, a source peer 115, a destination 120, and a destination peer 125. In some embodiments, multiple destinations 120 and destination peers 125 (not shown) are part of the network device 100 and may also receive the application message. The network device 100 depicted in FIG. 1 and the network devices depicted in FIGS. 3, 5, and 7 (to be described below) are merely examples and are not intended to unduly limit the scope of embodiments of the present invention as recited in the claims. One of ordinary skill in the art would recognize many variations, alternatives, and modifications. Network device 100 and the network devices depicted in FIGS. 3, 5, and 7 may be embodied in various different forms. For example, in one embodiment, network device 100 may be embodied as a switch or router or other network device such as those provided by Brocade Communications Systems, Inc. of San Jose, Calif.

In some embodiments, the source 110, the source peer 115, the destination 120, and the destination peer 125 are each a processing entity of a plurality of processing entities of network device 100. Processing entities may include, but are not limited to, physical processing units, logical processing units, or virtual processing entities. In one implementation, processing entities may include a group of one or more processing units, control circuits, and associated memory. For instance, a processing entity may be a management card or a line card of a network device. Alternatively, a processing entity may be one of multiple processing entities of a management card or a line card of a network device. In another implementation, a processing entity may include a processing unit, such as an AIM, Intel, AMD, ARM, TI, or Freescale Semiconductor, Inc. single-core or multicore processor, or an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA) running on a management card or a line card. In yet another implementation, the processing entity may include a logical processing unit within a physical processing unit. In yet another implementation, the processing entity may be a virtual processing entity or a software partitioning, such as a virtual machine, hypervisor, software process or an application running on a processing unit, such as a processor.

Each of the source 110, the source peer 115, the destination 120, and the destination peer 125 depicted in FIG. 1 includes running instantiations of an application 130 and the HAML 140. The source 110 of an application message is the processing entity upon which the instantiation of the application 130 transmitting the message is running. The message is intended (e.g., designated) to be transmitted to the instantiation of the application 130 running on the processing entity that is the destination 120. For full redundancy, each processing entity of the network device 100 needs to have a dedicated peer processing entity within the network device 100 that can take over processing in the event of a failover. A peer processing entity is configured or configurable to perform the same functions as the functions for which the processing entity to which it is peer is configured or configurable to perform. For example, the source 110 and the source peer 115 are both configured or configurable to perform the same functions. Likewise, the destination 120 and the destination peer 125 are both configured or configurable to perform the same functions. The peer relationship may be reciprocal. For example, the source 110 may also be the peer to the source peer 115, and the destination 120 may also be the peer to the destination peer 125. In other embodiments, there is less than full redundancy, wherein processing entities of the network device 100 share peer processing entities instead of each having a dedicated peer processing entity. In some embodiments, there is no redundancy, wherein there are no peer processing entities in the network device 100.

In certain embodiments, each processing entity of the network device 100 operates in one of multiple roles. An individual processing entity may be configured or configurable to operate in one or more of those multiple roles. In some embodiments, a processing entity may be configured or configurable to retain hardware awareness, which may refer to the awareness of the role in which the processing entity is currently operating. In some embodiments, hardware awareness is supported by the message transport used by the HAML, such as a Messaging Interface (MI) layer as described in Chin.

In one embodiment, the roles of the processing entities may include an active role and a standby role of the active-standby model used to enhance the availability of the network device. According to the active-standby model, a network device may comprise two processing entities where one of the processing entities is configured or configurable to operate in an “active” mode and the other is configured or configurable to operate in a “passive” (or standby) mode. The processing entity operating in the active mode (referred to as the active processing entity) is generally configured or configurable to perform a full set of networking functions, while the processing unit operating in passive or standby mode (referred to as the passive or standby processing entity) is configured or configurable to not perform the full set of networking functions or to perform only a small subset of the functions performed by the active processing entity. Upon an event that causes the active processing entity to reboot or fail (referred to as a switchover or failover event), which may occur, for example, due to an error in the active processing entity, the passive processing entity starts to operate in active mode and starts to perform functions that were previously performed by the previous active processing entity. The previous active processing entity may start to operate in standby mode. Processing entities that are operating in active mode may thus be operating in the active role and processing entities operating in the passive or standby mode may thus be operating in the passive or standby role.

FIG. 1 depicts the messaging between the processing entities of network device 100 when an application message is delivered from the source 110 to the destination 120. Although a failover at the source 110 or the destination 120 is not depicted in FIG. 1, the messaging illustrated and described below would ensure successful delivery even if a failover occurred. For ease of reference, instantiations of the application 130 and the HAML 140 running on a processing entity of network device 100 will be referred to below simply as the application 130 or the HAML 140, respectively, with the particular instantiation implied based on the context.

In some embodiments, the application 130 uses the HAML 140 by calling APIs implemented to perform the HAML functions. The Appendix provides example APIs for the HAML that may be implemented in accordance with an embodiment of the present invention. Example APIs are included for opening an HAML endpoint, sending messages to destination and destination peer endpoints, receiving messages, notifying the HAML of completed processing of a message, and closing of an HAML endpoint. Specific embodiments described in the Appendix are not limiting examples of the invention.

FIG. 1 will be described with reference to the simplified flowchart 200 of FIG. 2, which depicts transporting of the message between the processing entities according to an embodiment of the present invention. In the exemplary embodiments depicted in FIGS. 1 and 2, the HAML 140 is used to transmit a message from one source 110 to one destination 120. However, this is not intended to be limiting. The HAML may be used to transmit a message to one or more destinations 120 (not shown) and to their one or more destination peers 125 (not shown). The processing depicted in FIG. 2 and in FIGS. 4 and 6 (to be described below) may be implemented in software (e.g., code, instructions, program) executed by one or more processing units (e.g., processors, cores), hardware, or combinations thereof. In certain embodiments, the software may be stored on a non-transitory computer-readable storage device or medium. The particular series of processing steps depicted in FIGS. 2, 4, and 6 is not intended to be limiting.

At 202, at the source 110, the application 130 generates a message and sends the message to the HAML 140, which transmits the message to the source peer 115 and blocks the application 130 running on the source 110. For example, the HAML 140 can transmit the message down the local OSI network stack of the source 110, through a bus interconnecting the processing entities of the network device 100, and up the OSI network stack of source peer 115. In some embodiments, the HAML 140 transmits the message down the local OSI network stack using an MI layer protocol as described in Chin. The application 130 may cause the HAML 140 to transmit the message, for example, by calling the haml_sendmsg( ) API of the Appendix. In some embodiments, the source 110 is operating in a first role of multiple roles. For example, the source 110 may be operating in an active role. In some embodiments, the message includes information indicative of a role or state or function performed by the destination 120.

At 204, at the source peer 115, the HAML 140 receives the message and stores the message. In some embodiments, the message is stored in a pending queue of the source peer 115. The message is stored at the source peer 115 to ensure that a copy of the message exists for transmission in the event that a failure event occurs at the source 110 before the source 110 can transmit the message to the destination 120. In some embodiments, the source peer 115 is operating in a second role of multiple roles. For example, the source peer 115 may be operating in a passive or standby role, wherein the source peer 115 can switch to an active role upon a failure event occurring at its peer, the source 110.

In some embodiments, messages pending in the HAML 140 running on the source 110 may be synchronized to the HAML 140 running on the source peer 115 when the source peer 115 first comes online, e.g., after a reboot. In some embodiments, the source peer 115 will not process any messages until this reconciliation with the source 110 is completed in order to avoid transmitting messages out of order. If messages pending in the HAML 140 running on the source 110 cannot be synchronized to the HAML 140 running on the source peer 115, sync may be declared lost. When this occurs, sync may be restored, for example, by rebooting the source peer 115.

At 206, the source peer 115 transmits an acknowledgment to the source 110 indicating that the message was received at the source peer 115. In some embodiments, the acknowledgement is sent by the HAML 140 running on the source peer 115. In other embodiments, the acknowledgment is sent by a different networking layer, e.g., an MI layer as described in Chin.

At 208, at the source 110, the HAML 140 receives the acknowledgment transmitted at 206, and in response, unblocks (i.e., returns control to) the application 130. In some embodiments, this is an asynchronous send of the message, in that control can be returned to the application 130 running on the source 110 without waiting for the destination 120 to acknowledge receiving the message. Alternatively, if the application 130 needs to know that the destination 120 received the message, the send may be synchronous, wherein the HAML 140 will not unblock (i.e., return control to) the application 130 until the HAML 140 receives an acknowledgement that the destination 120 received the message.

In some embodiments, the application 130 running on the source 110 can batch messages. All messages except for the final message of the batch can be sent as non-blocking. Following transmission of each message except for the final message, control will be returned to the application 130 without waiting for any acknowledgements, including acknowledgment that the source peer 115 received the message. Only the final message of the batch needs to receive the acknowledgement transmitted at 206 indicating that the message was received at the source peer 115. Since messages are guaranteed to be delivered in order, acknowledgment received for the final message implies that all other messages of the batch have been received. This provides the benefit of reducing overall latencies at the source 110 and allowing the source 110 to synchronize at key points.

At 210, at the source 110, the HAML 140 multicasts (i.e., transmits at the same time) the message to both the destination 120 and the destination peer 125; and the destination 120 and the destination peer 125 receive the message. The destination peer 125 stores the message (e.g., in a pending queue of the destination peer 125) to ensure that a copy of the message exists for processing in the event that a failure event occurs at the destination 120 before the destination 120 can process the message. In some embodiments, the HAML 140 multicasts the message using an MI layer as described in Chin. In some embodiments, the HAML 140 transmits the message to the source peer 115, the destination 120, and the destination peer 125 simultaneously.

In some embodiments, the message includes information indicative of the role in which the intended (e.g., designated) destination of the message is operating. For example, the application 130 may specify that the message is to be transmitted to both the active destination (e.g., destination 120 operating in a first role, the active role) and the passive or standby destination (e.g., the peer destination 125 operating in a second role, the passive or standby role). Alternatively, the application 130 may specify that the message is only to be transmitted to the active destination (e.g., destination 120). In some embodiments, the application 130 running on the source 110 intends the message to be sent to multiple destinations, wherein at 210, the HAML 140 multicasts the message to the multiple intended (e.g., designated) destinations (e.g., multiple destinations 120 not shown in FIG. 1) and to the peers to the multiple intended destinations (e.g., multiple destination peers 125 not shown in FIG. 1).

At 212, the destination 120 and the destination peer 125 transmit acknowledgments to the source 110 indicating that the message was received at the destination 120 and the destination peer 125, respectively. In some embodiments, the acknowledgements are transmitted by the HAML 140 running on the destination 120 and the destination peer 125. In other embodiments, the acknowledgments are transmitted by a different networking layer, e.g., the MI layer described in Chin. In some embodiments, a single acknowledgment is transmitted to the source 110 to indicate that the message was received at both the destination 120 and the destination peer 125.

In some embodiments, messages that are not yet processed by the application 130 running on the destination 120 may be synchronized to the HAML 140 running on the destination peer 125 when the destination peer 125 first comes online, e.g., after a reboot. In some embodiments, the destination peer 125 will not process any messages until this reconciliation with the destination 120 is completed in order to avoid receiving messages out of order. If messages that are not yet processed by the application 130 running on the destination 120 cannot be synchronized to the HAML 140 running on the destination peer 125, sync may be declared lost. When this occurs, sync may be restored, for example, by rebooting the destination peer 125.

In some embodiments, if the destination 120 and the destination peer 125 do not receive the message multicast at 210 and/or do not transmit acknowledgments to the source 110 indicating that the message was received, the HAML 140 running on the source 110 may transmit an error notification to the application 130 indicating that an error occurred. The error notification may be transmitted when the message cannot be delivered to any of one or more destinations or any of the peers to the one or more destinations. An error may occur, for example, when the receive queue of a destination is full or the destination is experiencing congestion. A slow receiver can cause this error to occur. In some embodiments, the HAML 140 receives backpressure notification (e.g., from an MI layer described in Chin) if a destination is experiencing congestion. Failure events may also have occurred at both the destination 120 (e.g., the active processing entity) and the destination peer 125 (e.g., the standby processing entity). An error may also occur if an intended (e.g., designated) destination of the message does not exist. The error notification may include information identifying the destination at which the message was not received and information identifying the type of error. The error notification may be transmitted asynchronously to when the original message was transmitted.

At 214, at the source 110, the HAML 140 receives the acknowledgments transmitted at 212, and in response, transmits a notification to the source peer 115 to remove the message at the source peer 115; and at the source peer 115, the HAML 140 receives the notification to remove the message. Once the acknowledgments are received indicating that the message was safely delivered, the message no longer needs to be stored for possible retransmission by the source peer 115. With a synchronous send, the HAML 140 running on the source 110 unblocks the application 130 when it receives the acknowledgments transmitted at 212.

At 216, at the source peer 115, the HAML 140, in response to receiving the notification, removes the message stored at the source peer 115. The sending of the message is complete at this point, and the message will not be resent if a source failover occurs. In some embodiments, if the source peer 115 is also an intended destination of the message, the HAML 140 will send the message to the application 130 to be read and processed. In some embodiments, the application 130 running on the source peer 115 can receive, read, and process the message at any time after the message is received by the HAML 140 at 204.

At 218, at the destination 120, the HAML 140 sends the message to the application 130, where the message is read and processed. After the application 130 has completed processing the message, the application 130 notifies the HAML 140 that processing is complete. In some embodiments, any operations to synchronize the destination peer 125 with the destination 120 that may be triggered by the message need to be completed by the application 130 before the HAML 140 is notified that message processing is complete. The application 130 may notify the HAML 140 that processing is complete, for example, by calling the haml_msgdone( ) API of the Appendix.

At 220, in response to being notified that message processing is complete, the HAML 140 running on the destination 120 transmits a notification to the destination peer 125 to remove the message stored at the destination peer 125; and at the destination peer 125, the HAML 140 receives the notification to remove the message. Once processing of the message is completed at the destination 120, the message no longer needs to be stored for possible processing by the destination peer 125. In some embodiments, messages can be marked as not needing the application 130 running on the destination 120 to notify the HAML 140 that message processing is complete. For example, notification that the HAML 140 has completed message processing may not be needed in full destination HA messaging mode, which is described further below. In this mode, the destination 120 and the destination peer 125 are both intended destinations of the message, and each will process the message independently of the other.

At 222, at the destination peer 125, the HAML 140, in response to receiving the notification, removes the message stored at the destination peer 125. In some embodiments, if the destination peer 125 is also an intended destination of the message, the HAML 140 may send the message to the application 130 to be read and processed. In some embodiments, the application 130 running on the destination peer 125 can receive, read, and process the message once the HAML 140 running on the destination peer 125 receives the message, and does not need to wait for notification of completed message processing by the destination 120. This may occur, for example, when operating in full destination HA messaging mode, where the destination 120 and the destination peer 125 process the message independently of each other.

Although a failover at the source 110 or the destination 120 is not depicted in FIG. 1, the messaging illustrated and described above would ensure successful delivery even if a failover occurred. One challenge of transmitting messages in an HA messaging environment is ensuring that messages can be delivered when the source suffers a failure event. It is not possible to recover an application message from a source if an uncontrolled failover occurs before information about the message can be preserved. However, by using the HAML messaging described herein, the window in which messages can be lost can be greatly reduced relative to the window with messaging using typical networking protocols implemented by conventional network devices.

An example is now provided in which a failure event occurs at the source 110. FIG. 3 depicts the messaging between the processing entities of network device 300 when an application message from the source 110 is delivered by the source peer 115 to the destination 120. As with the network device 100 of FIG. 1, the network device 300 of FIG. 3 includes, with reference to an application message, the source 110, the source peer 115, the destination 120, and the destination peer 125. Any of the one or more embodiments described above with respect to the network device 100 of FIG. 1 may also apply to the network device 300, although the embodiments described above are not intended to be limiting.

FIG. 3 will be described with reference to the simplified flowchart 400 of FIG. 4, which depicts transporting of a message between processing entities when a failure event occurs at the source of the message according to an embodiment of the present invention. FIG. 4 includes steps 202, 204, 206, 208, and 210 of the flowchart 200 of FIG. 2, renumbered as steps 402, 404, 406, 408, and 410, respectively.

At 402, at the source 110, the application 130 generates a message and sends the message to the HAML 140, which transmits the message to the source peer 115 and blocks the application 130.

At 404, at the source peer 115, the HAML 140 receives the message and stores the message. The message is stored at the source peer 115 to ensure that a copy of the message exists for transmission in the event that a failure event occurs at the source 110 before the source 110 can transmit the message to the destination 120. If a failure occurs at the source 110 before the message has been synced (i.e., received and stored by the source peer 115), the message is lost, and the application 130 should consider the message as not being transmitted. However, the application 130 should not assume that the destination 120 did not receive the message. If a source failover has not yet occurred, and the HAML 140 stores the message at the source peer 115 (e.g., in a pending queue), delivery of the message is guaranteed from this point onwards.

At 406, the source peer 115 transmits an acknowledgment to the source 110 indicating that the message was received at the source peer 115. A failure event at the source 110 may occur before the source peer 115 transmits this acknowledgment at 406. Thus, because this step may not occur before the source failover, the step is depicted in FIGS. 3 and 4 with a dashed line.

At 408, at the source 110, the HAML 140 receives the acknowledgment transmitted at 406, and in response, unblocks the application 130. Like 406, a failure event at the source 110 may occur before this step is performed. Thus, because this step may not occur before the source failover, the step is depicted in FIGS. 3 and 4 with a dashed line.

At 410, at the source 110, the HAML 140 multicasts (i.e., transmits at the same time) the message to both the destination 120 and the destination peer 125; and the destination 120 and the destination peer 125 receive the message. The destination peer 125 stores the message. Like 406 and 408, a failure event at the source 110 may occur before this step is performed, and thus, the step is depicted in FIGS. 3 and 4 with a dashed line.

At 412, the source 110 has a failure event. When this occurs, the source 110, which may have previously operated in a first role (e.g., an active role), may no longer operate in that first role. In some embodiments, the source 110 then switches to a second role (e.g., a passive or standby role).

At 414, the source peer 115 switches role to act as the new source for the message. For example, the source peer 115 may have previously operated in a second role (e.g., the passive or standby role), but upon the failure event occurring at the source 110, the source peer 115 switches to operate in the first role (e.g., the active role), as the new source.

At 416, at the source peer 115 now acting as the new source, the HAML 140 multicasts (i.e., transmits at the same time) the message to both the destination 120 and the destination peer 125; and the destination 120 and the destination peer 125 receive the message. In some embodiments, the application 130 is idempotent and can properly handle duplicate messages if they are received, for example, if the failover occurs after 410 but before step 212 of FIG. 2. In some embodiments, the HAML 140 may prevent duplicate messages from being delivered to the application 130.

At 418, the destination 120 and the destination peer 125 transmit acknowledgments to the source peer 115, as the new source, indicating that the message was received at the destination 120 and the destination peer 125, respectively. The destination peer 125 stores the message to ensure that a copy of the message exists for processing in the event that a failure event occurs at the destination 120 before the destination 120 can process the message.

From this point, the process flow can continue on from step 218 through step 222 of FIG. 2. Thus, as long as a source failover does not occur before the HAML 140 stores the message at the source peer 115 (e.g., in a pending queue), the message is guaranteed to be delivered.

Not only can the message source failover, the message destination can also failover. The HAML handles the destination failover problem by automatically multicasting messages to both the intended destination (e.g., the active destination) and the destination peer (e.g., the passive or standby destination). Thus, the HAML keeps the message queue of the destination peer synchronized with the message queue of the destination. When a destination failover occurs, the receive queue of the destination peer is fully synchronized, and the applications on the destination peer, now the new destination, can begin processing messages without needing to take any other actions, such as requesting retransmission of any messages. If the message is intended for multiple destinations, the message may be multicast to each of those intended destinations (e.g., the active destinations) and to each peer to those intended destinations (e.g., the passive or standby destinations).

An example is now provided in which a failure event occurs at the destination 120. FIG. 5 depicts the messaging between the processing entities of network device 500 when an application message from the source 110 is delivered to both the destination 120 and the destination peer 125, but the message is only processed by the destination peer 125. As with the network device 100 of FIG. 1, the network device 500 of FIG. 5 includes, with reference to an application message, the source 110, the source peer 115, the destination 120, and the destination peer 125. Any of the one or more embodiments described above with respect to the network device 100 of FIG. 1 may also apply to the network device 500, although the embodiments described above are not intended to be limiting.

FIG. 5 will be described with reference to the simplified flowchart 600 of FIG. 6, which depicts transporting of a message between processing entities when a failure event occurs at the intended destination of the message according to an embodiment of the present invention. FIG. 6 includes steps 202, 204, 206, 208, 210, 212, 214, and 216 of the flowchart 200 of FIG. 2, renumbered as steps 602, 604, 606, 608, 610, 612, 614, and 616, respectively.

At 602, at the source 110, the application 130 generates a message and sends the message to the HAML 140, which transmits the message to the source peer 115 and blocks the application 130. At 604, at the source peer 115, the HAML 140 receives and stores the message. At 606, the source peer 115 transmits an acknowledgment to the source 110 indicating that the message was received at the source peer 115. At 608, at the source 110, the HAML 140 receives the acknowledgment transmitted at 206, and in response, unblocks the application 130.

At 610, at the source 110, the HAML 140 multicasts (i.e., transmits at the same time) the message to both the destination 120 and the destination peer 125; and the destination 120 and the destination peer 125 receive the message. The destination peer 125 stores the message to ensure that a copy of the message exists for processing in the event that a failure event occurs at the destination 120 before the destination 120 can process the message. If a destination failover has not yet occurred, and the HAML 140 stores the message at the destination peer 125 (e.g., in a pending queue), processing of the message is guaranteed from this point onwards.

At 612, the destination 120 and the destination peer 125 transmit acknowledgments to the source 110 indicating that the message was received at the destination 120 and the destination peer 125, respectively. At 614, at the source 110, the HAML 140 receives the acknowledgments transmitted at 612, and in response, transmits a notification to the source peer 115 to remove the stored message; and at the source peer 115, the HAML 140 receives the notification to remove the message. At 616, at the source peer 115, the HAML 140, in response to receiving the notification, removes the stored message. In some scenarios, the destination failure event may occur before one or more of steps 612, 614, and 616. Thus, steps 612, 614, and 616 are depicted in FIGS. 5 and 6 with a dashed line.

At 618, the destination 120 has a failure event. When this occurs, the destination 120, which may have previously operated in a first role (e.g., an active role), may no longer operate in that first role. In some embodiments, the destination 120 then switches to a second role (e.g., a passive or standby role).

At 620, the destination peer 125 switches role to act as the new destination for the message. For example, the destination peer 125 may have previously operated in a second role (e.g., the passive or standby role), but upon the failure event occurring at the destination 120, the destination peer 125 switches to operate in the first role (e.g., the active role), as the new destination.

At 622, at the destination peer 125 now acting as the new destination, the HAML 140 sends the message to the application 130, where the message is read and processed. After the application 130 has completed processing the message, the application 130 may notify the HAML 140 that processing is complete.

In some embodiments, the application 130 is idempotent and can properly handle duplicate messages if they are received. For example, the synchronization message from the destination 120, now the old destination, may not have been received before the failover occurred. In some embodiments, the HAML 140 may prevent duplicate messages from being delivered to the application 130.

In some embodiments, the HAML may provide multiple message delivery modes to facilitate different messaging requirements of applications running on processing entities of a network device. Modes may be provided for different levels of HA messaging support in the sending of messages, and different levels of HA messaging support in the delivering of messages.

A first mode, which may be described as providing source HA messaging with passive destination HA messaging, is generally described in the embodiments above. In this mode, an application message is delivered to the source peer before the source is unblocked. The message is multicast to one or more destinations (e.g., active destinations) and the peers of the one or more destinations (e.g., passive or standby destinations). Only the one or more destinations process the message. That is, the one or more destination peers do not process the message unless a destination failover occurs. When the HAML is notified that the processing of the message is completed on a destination, the stored message will be removed from the respective destination peer. It is expected that a destination will perform any needed HA messaging synchronization with its destination peer.

A second mode may be described as providing source HA messaging with full destination HA messaging. In this mode, messages are processed at the one or more destinations and the peers of the one or more destinations. As with the first mode, an application message is delivered to the source peer before the source is unblocked, and the message is multicast to all the destinations and their peers. The destination and its destination peer will process the message independently of each other. In this mode, the HAML does not need to be notified that the processing of the message is completed, because the message is not stored at the destination peer.

A third mode may be described as providing source HA messaging without destination HA messaging. In this mode, a message is transmitted only to one or more destinations (e.g., active destinations) but not to any peers of those one or more destinations (e.g., passive or standby destinations). As with the first mode, an application message is delivered to the source peer before the source is unblocked. However, the message is received at one or more destinations, while the one or more destination peers will not receive the message. In this mode, the HAML does not need to be notified that the processing of the message is completed, because the message is not stored at any destination peers.

A fourth mode may be described as not providing source HA messaging while providing passive destination HA messaging. In this mode, an application message is not delivered to the source peer. The message is multicast to one or more destinations (e.g., active destinations) and the peers of the one or more destinations (e.g., passive or standby destinations). The source is unblocked after the message is transmitted to the destinations. Only the one or more destinations process the message; the one or more destination peers do not process the message unless a destination failover occurs. When the HAML is notified that the processing of the message is completed on a destination, the stored message will be removed from the respective destination peer. It is expected that a destination will perform any needed HA messaging synchronization with its destination peer.

A fifth mode may be described as not providing source HA messaging while providing full destination HA messaging. In this mode, an application message is not delivered to the source peer. The message is multicast to one or more destinations (e.g., active destinations) and the peer(s) of the one or more destinations (e.g., passive or standby destinations). The source is unblocked after the message is transmitted to the destinations. The destination and its destination peer will process the message independently of each other. In this mode, the HAML does not need to be notified that the processing of the message is completed, because the message is not stored at the destination peer.

A sixth mode may be described as disabling both source HA messaging and destination HA messaging. In this mode, an application message is not delivered to the source peer or to any destination peers (e.g., passive or standby destinations). Applications may use this mode to transmit non-critical messages to one or more destinations. The source is unblocked after the message is transmitted to the one or more destinations. Only the one or more destinations receive and process the message. In this mode, the HAML does not need to be notified that the processing of the message is completed, because the message is not stored at any destination peers.

FIG. 7 is another simplified block diagram of a network device 700 that may incorporate an embodiment of the present invention. Network device 700 may be a router or switch that is configured to forward data such as a router or switch provided by Brocade Communications Systems, Inc. In one implementation the network device 700 may be configured to perform HA application messaging. The HA application messaging services include services and functions related to facilitating transporting of application messages. In one embodiment, network device 700 provides guaranteed application message delivery within a network device even in the event of a failure at the source and/or at the intended destination of a message.

In the embodiment depicted in FIG. 7, network device 700 may comprise a plurality of ports (not shown) for receiving and forwarding data packets and multiple cards that are configured to perform processing to facilitate forwarding of the data packets. The multiple cards may include one or more line cards (706, 708, and 710) and one or more management cards (702 and 704). Each card may have one or more processing entities and various other computing resources, such as volatile and non-volatile memory. Although referred to as a management card or line card, the card may be a System of a Chip (SoC) or a circuit board. In one embodiment, a card, sometimes also referred to as a blade or module, can be inserted into one of a plurality of slots on the chassis of network device 700. This modular design allows for flexible configurations with different combinations of cards in the various slots of the device according to differing network topologies and switching requirements. The components of network device 700 depicted in FIG. 7 are meant for illustrative purposes only and are not intended to limit the scope of the invention in any manner. Alternative embodiments may have more or less components than those shown in FIG. 7.

The slots on the chassis of network device 700 may have identifiers. For example, the slots occupied by the line cards of network device 700 are identified as LC slot 1, LC slot 2, and LC slot 3. In one implementation, each card of the network device 700 is associated with a unique slot identifier. For example, line card 706 is associated with a unique slot identifier LC slot 1. Line card 706 may have multiple processing entities, such as a first processing entity 712 and a second processing entity 714 depicted in FIG. 7. In another implementation, multiple cards (e.g., multiple line cards) can be associated with the same slot identifier. For example, the identifier LC slot 1 could alternatively be associated with both of line cards 706 and 708, each of which may have one or more processing entities.

Network device 700 is configured or configurable to receive and forward data using ports. Upon receiving a data packet via an input port, network device 700 is configured or configurable to determine an output port to be used for transmitting the data packet from the network device 700 to facilitate communication of the packet to another network device or network. Within network device 700, the packet is forwarded from the input port to the determined output port and transmitted from network device 700 using the output port. In one embodiment, forwarding of packets from an input port to an output port is performed by one or more line cards. Line cards represent the data forwarding plane of network device 700. Each line card may comprise one or more processing entities that are each configured or configurable to perform forwarding of data packets. A processing entity on a line card may also be referred to as a line card processing entity. Each line card processing entity may have an associated packet processor (e.g., a processor or a core) and associated memories or portions of memories to facilitate the packet forwarding process. Since processing performed by a packet processor needs to be performed at a high packet rate in a deterministic manner, the packet processor is generally a dedicated hardware device configured to perform the processing. In one embodiment, the packet processor is a programmable logic device such as an FPGA. The packet processor may also be an ASIC.

The management cards 702 and 704 are configured or configurable to perform management and control functions for network device 700 and thus represent the management plane for network device 700. In one embodiment, management cards 702 and 704 are communicatively coupled to line cards via bus 724 and include software and hardware for controlling various operations performed by the line cards. In one embodiment, more than one management card (e.g., management cards 702 and 704) may be used, with each management card controlling one or more line cards. In alternative embodiments, a single management card may be used for all the line cards in a network device.

The management cards 702 and 704 may each comprise one or more processing entities that are each configured or configurable to perform functions performed by the management card and associated memory. Each processing entity of a management card may have an associated processor (also referred to as a management processor) and associated memories or portions of memories to perform management and control functions. In one embodiment, a management processor is a general purpose single-core or multicore microprocessor such as ones provided by AIM, Intel, AMD, ARM, TI, Freescale Semiconductor, Inc., and the like, that operates under the control of software stored in associated memory or portions of memory.

FIG. 8 is a simplified block diagram of a processing entity 800 of a card (e.g., a management card or a line card) of a network device that may incorporate an embodiment of the present invention. The components of processing entity 800 depicted in FIG. 8 are meant for illustrative purposes only and are not intended to limit the scope of the invention in any manner. Alternative embodiments may have more or fewer components than those shown in FIG. 8.

In the embodiment depicted in FIG. 8, a processing entity 800 comprises a processor 802 (e.g., a packet processor or a management processor) with associated volatile memory 804 and non-volatile memory 806 that are dedicated only to that processing entity 800. In other embodiments, the volatile memory 804 and/or the non-volatile memory 806 associated with the processing entity 800 are/is portion(s) of one or more memories that are each associated with multiple processing entities of the card. The processor 802 is configured or configurable to execute software that controls the operations of the processing entity 800. The software that is loaded into volatile memory 804 and executed by the processor 802 may be in the form of programs/code/instructions, data constructs, and APIs. The APIs may include one or more of the APIs described above or the APIs provided in the Appendix. Volatile memory 804 is typically a random access memory (RAM) and sometimes referred to as system memory. Non-volatile memory 806 may be of different types including a compact flash, a hard disk, an optical disk, and the like. Non-volatile memory 806 may also store programs/code/instructions that are to be loaded in volatile memory 804 and executed by the processor 802 and also any related data constructs and APIs.

The volatile memory 804 of FIG. 8 includes native operating system (OS) 812, the HAML 814, network operating system (NOS) 816, platform services 818, and user applications 820. Native OS 812 is generally a commercially available operating system such as Linux, Unix, Windows OS, or other operating system. NOS 816 provides the foundation and support for networking services provided by the network device. In one embodiment, the HAML 814 may be provided as a component of NOS 816. Platform services component 818 may comprise logic for blade-level management (in a chassis-based network device with multiple blades), chassis environment setup, power supply management, messaging services, daemons support, support for command line interfaces (CLIs), etc. User applications 820 and potentially other applications may also be stored in volatile memory 804.

One or more of the management cards 702 and 704 and/or line cards 706, 708, and 710 of network device 700 of FIG. 7 may be implemented with one or more processing entities as depicted in the processing entity 800 of FIG. 8. The embodiment depicted in FIG. 7 depicts a chassis-based system. This however is not intended to be limiting. Certain embodiments of the present invention may also be embodied in non-chassis based network devices, which are sometimes referred to as “pizza boxes.” Such a network device may comprise a single physical multicore CPU or multiple physical multicore CPUs.

Embodiments of the invention enable reliable communication between the various processing entities within the network device 700 using the HAML protocol. In one exemplary configuration of network device 700, the network device 700 has an active management card 702 and a passive or standby management card 704. As shown in FIG. 7, the network device 700 has three slots identified as LC slot 1, 2, and 3 occupied by the three line cards 706, 708, and 710, respectively. Other embodiments may have fewer or more management cards and/or fewer or more line cards.

During normal operation of the network device 700, one of the two management cards 702 and 704 operates in an active role while the other management card operates in a passive or standby role. When operating in active mode, a management card is referred to as the active management card and is responsible for performing the control and forwarding functions for network device 700. The processing entity of the active management card operates as the active processing entity. When operating in standby mode, a management card is referred to as the standby management card and does not perform, or performs just a subset of, the control and forwarding functions performed by the active management card. The processing entity of the standby management card operates as the standby processing entity. In the embodiment depicted in FIG. 4, management card 702 is the active management card and management card 704 is the standby management card. A failover or switchover may, however, causes the management card 704 to become the active management card, and causes the management card 702 to become the standby management card.

In other embodiments, the management cards 702 and 704 each comprise two processing entities, wherein one processing entity at each of the management cards 702 and 704 operates in active mode, while the other processing entity at each of the management cards 702 and 704 operates in passive or standby mode. A failover or switchover occurring in one of the two management cards 702 or 704 would cause the standby processing entity of the affected management card to become the active processing entity, and cause the active processing entity of the affected management card to become the standby processing entity.

Each of the line cards 706, 708, and 710 of the network device 700 has two processing entities, although line cards may have fewer or more processing entities in other embodiments. When operating in active mode, a processing entity of a line card, referred to herein as an active processing entity, is responsible for providing packet forwarding services for network device 700. When operating in passive or standby mode, a processing entity of the line card, referred to herein as a passive or standby processing entity, does not perform, or performs just a subset of, the packet forwarding services performed by the active processing entity of the line card. During normal operation of the network device 700, each of the line cards 706, 708, and 710 has an active processing entity and a standby processing entity. In the embodiment depicted in FIG. 7, the line card 706 associated with the identifier LC slot 1 has the active processing entity 712 and the standby processing entity 714; the line card 708 associated with the identifier LC slot 2 has the active processing entity 716 and the standby processing entity 718; and the line card 710 associated with the identifier LC slot 3 has the active processing entity 720 and the standby processing entity 722. A failover or switchover may, however, cause the active processing entity of a line card to become the standby processing entity of the line card, and cause the standby processing entity of the line card to become the active processing entity of the line card.

In other embodiments, the line cards of network device 700 each comprise only one processing entity, wherein the one processing entity at each line card operates in either the active mode or the standby mode. The line card would operate as an active line card or a standby line card, respectively. For full redundancy, each line card would need a dedicated peer line card to handle failover or switchover. A failover or switchover occurring in an active line card would cause the peer line card to become the active line card, and cause the previously active line card to become the new standby line card. In some embodiments, both a line card and its peer line card may be associated with a common slot identifier, e.g., LC slot 1. This allows the HAML to multicast messages to both the line card and its peer line card using the common slot identifier.

During normal operations, the active processing entities of the network device 700 are configured or configurable to manage the hardware resources of network device 700 and perform a set of networking functions. During this time, the standby processing entities may be passive and may not perform the set of functions performed by the active processing entities. When a failover or switchover occurs at an active processing entity, the standby processing entity for that active processing entity becomes the active processing entity and takes over management of hardware resources and performance of the set of functions related to network device 700 that was previously performed by the processing entity that was previously active and, as a result, the set of functions continues to be performed. The previous active processing entity may then become the standby processing entity and be ready for a subsequent failover or switchover of the new active processing entity. For example, for the embodiment depicted in FIG. 7, for line card 706, a failover will cause the standby processing entity 714 to become the new active processing entity, and cause the active processing entity 712 to become the new standby processing entity. The set of functions that are performed by an active processing entity on a card may differ from one network device to another. The active-standby model coupled with techniques described in this application enable functions to be performed without any interruption or any disruption to the applications even during or after a failover or switchover. This translates to higher availability of network device 700.

A switchover may be caused by various different events, including anticipated or voluntary events. A voluntary or anticipated event is typically a voluntary user-initiated event that is intended to cause the active processing entity to voluntarily yield control to the standby processing entity. An instance of such an event is a command received from a network administrator to perform a switchover. There are various situations when a network administrator may cause a switchover to occur on purpose, such as when software on the management card and line card processing entities is to be upgraded to a newer version. As another example, a switchover may be voluntarily initiated by the system administrator upon noticing performance degradation on the active processing entity or upon noticing that software executed by the processor of the active processing entity is malfunctioning. In these cases, the network administrator may voluntarily issue a command that causes a switchover, with the expectation that problems associated with the current active processing entity will be remedied when the standby processing entity becomes the new active processing entity. A command to cause a switchover may also be initiated as part of scheduled maintenance. Various interfaces, including a command line interface (CLI), may be provided for initiating a voluntary switchover.

A failover may be caused by various different events, including unanticipated or involuntary events. For example, a failover may occur due to some critical failure in the active processing entity, such as a problem with the software executed by the processor of the active processing entity, failure in the operating system loaded by the active processing entity, hardware-related errors on the active processing entity or other router component, and the like.

In one embodiment, network device 700 is able to perform a failover or switchover without interrupting the networking services offered by network device 700. Network device 700 is able to continue providing networking services at line rates without impact (e.g., without experiencing any packet loss) as a result of, or while performing, a failovcr or switchover.

The network device 700 of FIG. 7 illustrates a distributed software model wherein each card on the network device 700 has one or more processing entities, each processing entity executing its own operating system, and networking and application stack to perform collective routing tasks for the network device. The processing entities may communicate with each other over the bus 724. In one embodiment, the processing entities communicate with each other using networking protocols. FIG. 9 depicts an exemplary OSI network stack 900 for the networking protocols used in embodiments of the invention. Each card shown in FIG. 7 depicts the application (726, 732, etc.), the transport layer (TL) (738, 740, etc.), the network layer (NL) (728, 734, etc.), and the data link layer (DLL) (730, 736, etc.) of the OSI network stack executing on each processing entity. However, the processing entities on the cards may execute any number of the protocol layers from the OSI network stack 900, as depicted in FIG. 9, for communicating with each other.

Certain embodiments of the invention may implement a novel transport layer protocol, referred to as the HAML 918 protocol in this disclosure, and depicted in FIG. 9, for optimized communication amongst the various processing entities within the network device 700. Some embodiments of the invention may also implement a combined transport layer and network layer protocol, referred to as the MI layer 916 protocol depicted in FIG. 9, and described in Chin. In one embodiment, the HAML 918 may use one or more of the MI layer 916 protocol and another network layer protocol, e.g., the Internet Protocol (IP), for communicating amongst processing entities.

FIG. 9 illustrates an OSI network stack 900 that may be used in one embodiment of the invention. A network device may have multiple processing entities within the device. In a distributed software model, each processing entity may execute one or more applications running on an operating system and network system. The network system may comprise a network stack, such as the OSI network stack 900, shown in FIG. 9. The OSI network stack 900 may comprise the physical layer 914; the data link layer 912; the networking layer 910, which may further include the MI layer 916; the transport layer 908, which may further include the HAML 918 and possibly the MI layer 916; the session layer 906; the presentation layer 904; and the application layer 902.

Out of these layers from the OSI network stack 900, the transport layer 908 provides the functional and procedural means of end-to-end communication services for applications. One well-known transport layer protocol from the OSI network stack 900 is the Transmission Control Protocol (TCP). TCP is a reliable connection-oriented transport service that provides end-to-end reliability, re-sequencing, and flow control.

Embodiments of the invention describe the HAML protocol, an alternate implementation of the transport layer protocol. As shown in FIG. 9, in one implementation, the HAML 918 may co-exist with other transport layer 908 protocols, such as TCP and/or the MI layer 916 protocol. For example, in some embodiments, the HAML 918 is an extension of the transport layer provided by the MI layer 916 protocol. Thus, the HAML 918 can connect to the MI layer 916 to provide an enhanced transport layer to the applications.

Various embodiments described above can be realized using any combination of dedicated components and/or programmable processors and/or other programmable devices. The various embodiments may be implemented only in hardware, or only in software, or using combinations thereof. For example, the software may be in the form of instructions, programs, etc. stored in a computer-readable memory and may be executed by a processing unit, where the processing unit is a processor, a collection of processors, a core of a processor, a set of cores, etc. In certain embodiments, the various processing described above, including the processing depicted in the flowcharts in FIGS. 2, 4, and 6 can be performed in software without needing changes to existing device hardware (e.g., router hardware), thereby increasing the economic viability of the solution. Since certain inventive embodiments can be implemented entirely in software, it allows for quick rollouts or turnarounds along with lesser capital investment, which further increases the economic viability and attractiveness of the solution.

The various processes described herein can be implemented on the same processor or different processors in any combination, with each processor having one or more cores. Accordingly, where components or modules are described as being adapted to, configured to, or configurable to perform a certain operation, such configuration can be accomplished, e.g., by designing electronic circuits to perform the operation, by programming programmable electronic circuits (such as microprocessors) to perform the operation, by providing software or code instructions that are executable by the component or module (e.g., one or more processors) to perform the operation, or any combination thereof. Processes can communicate using a variety of techniques including but not limited to conventional techniques for interprocess communication, and different pairs of processes may use different techniques, or the same pair of processes may use different techniques at different times. Further, while the embodiments described above may make reference to specific hardware and software components, those skilled in the art will appreciate that different combinations of hardware and/or software components may also be used and that particular operations described as being implemented in hardware might also be implemented in software or vice versa.

The various embodiments are not restricted to operation within certain specific data processing environments, but are free to operate within a plurality of data processing environments. Additionally, although embodiments have been described using a particular series of transactions, this is not intended to be limiting.

Thus, although specific invention embodiments have been described, these are not intended to be limiting. Various modifications and equivalents are within the scope of the following claims.

APPENDIX APIs for a High Availability Application Messaging Layer (HAML) haml_open( ) creates an HAML endpoint for communication and returns an HAML handle. #include <haml/haml.h> struct haml_op { const char * name; int instance; int (*cb)(int haml_handle, void *ctx); void * ctx; mq_t * mq;  } int haml_open(struct haml_op *hop, int fss_handle) The name and instance uniquely identify an HAML endpoint across the network device. haml_open( ) will create an HAML handle and will bind the name and instance to it. The fss_handle may be the value returned by fssd_register( ). It is expected the application will obtain an fss_handle prior to calling haml_open( ). The HAML uses the fss_handle when messages need to be sent over FSS during HAML sends. If FSS integration is not needed, fss_handle should be set to zero. All FSS operations can be done directly through FSS. The cb callback would be invoked with the ctx context provided here, when there are HAML messages pending for the application. The mq argument is a pointer to an ASP message queue that would be used for both HAML and FSS operations. If mq is NULL, the callback would be invoked in GIOT context. On success, the HAML handle (haml_handle) is returned as a positive integer. On error, haml_open( ) returns a negative error code. haml_sendmsg( ) is used to send HAML messages to destination endpoints and to the standby in a HA (High Availability) messaging safe manner. #include <haml/haml.h> int haml_sendmsg(int haml_handle, const struct msghdr * msg_header, int flags); haml_handle returned by haml_open( ) needs to be passed in as the first argument. The msg_header may be a pointer to a struct msghdr defined in a header file. The flags argument is the bitwise OR of zero or more of the following flags: HAML_FSS Use the FSS transport layer to send the message to the standby endpoint. HAML_SYNC Wait for an acknowledgment from all the destinations before returning. HAML_NOWAIT_STANDBY Return immediately after sending the message to all destinations without waiting for an acknowledgment. On success, haml_sendmsg( ) returns the number of bytes sent. On error, haml_sendmsg( ) returns a negative error code. haml_recvmsg( ) is used to receive a message from the HAML. #include <haml/haml.h> int haml_recvmsg(int haml_handle, const struct msghdr * msg_header, int flags); This function would need to be invoked as part of the callback provided to haml_open( ) to extract messages from HAML. haml_handle returned by haml_open( ) needs to be passed in as the first argument. The msg_header may be a pointer to a struct msghdr. The flags argument is the bitwise OR of zero or more of the following flags: HAML_PEEK Return message from the beginning of the receive queue without removing it from the queue. HAML_WAIT Block until you receive a message. HAML_NOWAIT Check for messages in a non-blocking manner. Return immediately if there are no pending messages. On success, haml_recvmsg( ) returns the number of bytes received. On error, haml_recvmsg( ) returns a negative error code. The cmsghdr in an ancillary data buffer associated with the msghdr would contain msg_id's for the received messages. haml_msgdone( ) is used by applications at the destination to notify the HAML that the processing of a message is complete. #include <haml/haml.h> int haml_msgdone(int haml_handle, int msg_id); haml_handle returned by haml_open( ) needs to be passed in as the first argument. The cmsghdr in an ancillary data buffer associated with the msghdr populated by haml_recvmsg( ) would contain msg_id for the corresponding messages. On success, haml_msgdone( ) returns 0. On error, haml_msgdone( ) returns −1. haml_close( ) closes an HAML endpoint. #include <haml/haml.h> void haml_close(int haml_handle) haml_close( ) does not return a value. 

1. A network device comprising: a first processing entity configured to operate in a first role and to transmit a message for an intended destination; and a second processing entity configured to operate in a second role and to receive the message, wherein upon occurrence of a failure event at the first processing entity, the second processing entity is configured to switch to operating in the first role to determine that the second processing entity is a source of the message based on the second processing entity operating in the first role, and to transmit the message to the intended destination.
 2. The network device of claim 1, further comprising: a third processing entity configured to operate in the first role and to receive the message, the third processing entity being the intended destination of the message; and a fourth processing entity configured to operate in the second role, to receive the message, and to store the message at the fourth processing entity, the fourth processing entity being a peer to the intended destination of the message.
 3. The network device of claim 2, wherein the first role is an active role, wherein a processing entity operating in the first role is further configured to perform a set of transport-related functions in the active role; and the second role is a standby role, wherein a processing entity operating in the second role is further configured to not perform the set of transport-related functions in the standby role.
 4. The network device of claim 2, wherein the first processing entity is further configured to receive an acknowledgement indicating that the message was received at the third processing entity and at the fourth processing entity, and in response to receiving the acknowledgement, to transmit a notification to the second processing entity to remove the message stored at the second processing entity; and the second processing entity is further configured to receive the notification, and in response to receiving the notification, to remove the message stored at the second processing entity.
 5. The network device of claim 4, wherein the fourth processing entity is further configured to switch to operation in the first role from the second role when the third processing entity is no longer operating in the first role, to read the message, and to process the message.
 6. The network device of claim 2, wherein the third processing entity is further configured to read the message, to process the message, and after processing the message, to transmit a notification to the fourth processing entity to remove the message stored at the fourth processing entity; and the fourth processing entity is further configured to receive the notification, and in response to receiving the notification, to remove the message stored at the fourth processing entity.
 7. The network device of claim 2, wherein the first processing entity is further configured to block control, to receive an acknowledgement indicating that the message was received at the second processing entity, and in response to receiving the acknowledgement, to unblock control.
 8. The network device of claim 7, wherein the second processing entity is further configured to switch to operation in the first role from the second role when the first processing entity is no longer operating in the first role, and to transmit the message for the intended destination.
 9. The network device of claim 2, wherein the first processing entity is further configured to receive an error notification indicating that the message was not received at the third processing entity.
 10. The network device of claim 2, wherein the message is for a plurality of intended destinations; and the first processing entity is further configured to transmit the message to each intended destination of the plurality of intended destinations, and to transmit the message to each peer to each intended destination of the plurality of intended destinations.
 11. A method comprising: transmitting a message to an intended destination from a first processing entity operating in a first role, the first processing entity being the source of the message; receiving the message at a second processing entity operating in a second role, the message stored at the second processing entity; and upon occurrence of a failure event at the first processing entity, switching, by the second processing entity, to operating in the first role to determine that the second processing entity is a source of the message based on the second processing entity operating in the first role, and to transmit the message to the intended destination.
 12. The method of claim 11, further comprising: receiving the message at a third processing operating in the first role, the third processing entity being the intended destination of the message; and receiving the message at a fourth processing entity operating in the second role, the message stored at the fourth processing entity, the fourth processing entity being a peer to the intended destination of the message.
 13. The method of claim 12, wherein the first role is an active role, wherein a processing entity operating in the first role performs a set of transport-related functions in the active role; and the second role is a standby role, wherein a processing entity operating in the second role does not perform the set of transport-related functions in the standby role.
 14. The method of claim 12, further comprising: receiving at the first processing entity an acknowledgement indicating that the message was received at the third processing entity and at the fourth processing entity; in response to receiving the acknowledgement, transmitting a notification to the second processing entity to remove the message stored at the second processing entity; receiving the notification at the second processing; and in response to receiving the notification, removing the message stored at the second processing entity.
 15. The method of claim 13, further comprising: switching, by the fourth processing entity, to operating in the first role from the second role when the third processing entity is no longer operating in the first role; reading the message at the fourth processing entity; and processing the message at the fourth processing entity.
 16. The method of claim 12, further comprising: reading the message at the third processing entity; processing the message at the third processing entity; and after processing the message at the third processing entity, transmitting a notification to the fourth processing entity to remove the message stored at the fourth processing entity; receiving the notification at the fourth processing entity; and in response to receiving the notification at the fourth processing entity, removing the message stored at the fourth processing entity.
 17. The method of claim 12, further comprising: blocking control at the first processing entity; receiving at the first processing entity an acknowledgement indicating that the message was received at the second processing entity; and in response to receiving the acknowledgement, unblocking control at the first processing entity.
 18. The method of claim 17, further comprising: switching, by the second processing entity, to operating in the first role from the second role when the first processing entity is no longer operating in the first role; and transmitting the message for the intended destination from the second processing entity.
 19. The method of claim 12, further comprising receiving at the first processing entity an error notification indicating that the message was not received at the third processing entity.
 20. A network device comprising: a first processing entity configured to operate in a first role, the first processing entity being an intended destination of a message; and a second processing entity configured to operate in a second role and to receive the message, wherein upon occurrence of a failure event at the first processing entity, the second processing entity is configured to switch to operating in the first role to determine that the second processing entity is the intended destination based on the second processing entity operating in the first role, and to process the message as the intended destination. 